package com.yonyou.rabbitmq.receiver;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

//@Component
////代表消费者监听hello队列，有消息则消费 queuesToDeclare：指定队列，没有则创建
@RabbitListener(queuesToDeclare = @Queue("hello"))
public class HelloReceiver {

    @RabbitHandler  //代表统一调用此方法来处理队列中消息
    public void receive(String message){
        System.out.println("------message:"+message);
    }

}
